package com.soft.javase.day06.object.shallowcopy;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/24
 */
public class Person implements Cloneable {
    private String name;
    private int age;
    private Phone phone;

    public Person(String name, int age, Phone phone) {
        this.name = name;
        this.age = age;
        this.phone = phone;
    }

    @Override
    protected Person clone() throws CloneNotSupportedException {
        return (Person) super.clone();
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", phone=" + phone +
                '}';
    }

    public void setAge(int age) {
        this.age = age;
    }
}
